Skip to content

fix: resolve failing tests in TS utility library#206

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2532-1781368822
Open

fix: resolve failing tests in TS utility library#206
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2532-1781368822

Conversation

@stooit

@stooit stooit commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 failing tests across the utility library and implements missing functionality. All 60 tests now pass (0 failures); no test files modified and no dependencies added.

Changes

  • src/calculator.tsdivide now throws Error("Division by zero") instead of returning Infinity.
  • src/string-utils.tswordCount uses trim().split(/\s+/) so consecutive spaces no longer inflate the count; truncate implemented (respects maxLength budget incl. ellipsis, breaks at word boundary, hard-cuts when no space, handles maxLength smaller than ellipsis).
  • src/task-manager.ts — implemented remove (returns false for unknown id), update (title/priority, returns false for unknown id), and sortBy for priority (high>medium>low), createdAt (oldest first), and status.
  • src/date-utils.ts — fixed off-by-one in formatRelative (Math.round instead of Math.floor; 36h now reads "2 days ago").
  • src/validator.tsisEmail accepts long TLDs; isUrl accepts URLs with a port (e.g. http://localhost:3000).

Testing

bun test60 pass, 0 fail.

Assumptions

  • sortBy("status") uses alphabetical order as the tests assert.
  • formatRelative uses round-to-nearest semantics, matching the test expectations.
  • Reviewed by the review subagent: all fixes confirmed as genuine root-cause corrections.

🤖 Generated autonomously.

- calculator: throw on division by zero instead of returning Infinity
- string-utils: fix wordCount on consecutive spaces; implement truncate
- task-manager: implement remove, update, and sortBy (priority/createdAt/status)
- date-utils: fix off-by-one in formatRelative (round vs floor)
- validator: allow long TLDs in isEmail; allow ports in isUrl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant